package cn.haocxy.jfm.gui.dialog;

import javafx.event.ActionEvent;
import javafx.scene.control.Button;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;

public class DButton extends Button {

	public DButton(String text) {
		super(text);
		
		this.addEventHandler(KeyEvent.KEY_RELEASED, this::keyReleased);
	}
	
	private void keyReleased(KeyEvent e) {
		if (e.getCode().equals(KeyCode.ENTER)) {
			fireEvent(new ActionEvent());
		}
	}
}
